package se.webbzon.boltzmann.game.event;

import se.webbzon.boltzmann.game.sequence.Sequence;
import se.webbzon.oschi01.worldobject.WorldObject;

public abstract class AbstractTargetEvent extends AbstractGameEvent {
	
	// The sequence associated with this target event
	private final Sequence sequence;
	
	/*============================================================
	Constructors
	============================================================*/
	
	public AbstractTargetEvent(Sequence sequence, String[] arguments) {
		super(arguments);
		this.sequence = sequence;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the sequence associated with this event. **/
	public Sequence getSequence() {
		return sequence;
	}
	
	/** Returns the target set by the previous SetTargetEvent with the
	 * same key as this target event. **/
	public WorldObject getTarget() {
		if (arguments() > 0)
			return sequence.getBinding(getArgument(0));
		else
			return null;
	}

}
